import cv2
import numpy as np
img =cv2.imread('45.webp')
enable = False
def call_back_draw(event,x,y,flags,param):
    global  enable
    if event == cv2.EVENT_LBUTTONDOWN:
        enable=True
    elif event == cv2.EVENT_MOUSEMOVE and flags ==cv2.EVENT_FLAG_LBUTTON:
        if enable:
            drawMask(y,x)
    elif event ==cv2.EVENT_LBUTTONUP:
        enable =False

def drawMask(x,y,size=10):
    m=np.uint8(x/size)*size
    n= np.uint8(y / size) * size
    for i in range(size):
        for j in range(size):
            img[m+i,n+j]=img[m,n]
cv2.namedWindow('image')
cv2.setMouseCallback('image',call_back_draw)
while True:
    cv2.imshow('image',img)
    if cv2.waitKey(1) == ord('q'):
        break
cv2.destroyAllWindows()